package com.example.shop.goods.dto;

import com.example.shop.pojo.CommentsReply;
import com.fasterxml.uuid.Generators;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommentReplyInfoParam extends EvaluationBase{
    @NotNull
    private Long evaluationId;
    //对哪个评论的用户进行回复
    @NotNull
    private Long replyUserId;

    public CommentsReply toCommentReply(){
        CommentsReply commentsReply = new CommentsReply();

        commentsReply.setEvaluationId(evaluationId);
        //回复评论id: 根据时间生成UUID
        commentsReply.setReplyCommentsId(Generators.timeBasedGenerator().generate().node());
        commentsReply.setReplyCommentsUserId(replyUserId);
        commentsReply.setReplyContent(content);
        return commentsReply;
    }
}
